import h from "./h.js";
import patch from './patch.js'
// 获取到真的dom节点
let container = document.getElementById('container')
// 虚拟dom节点
let vnode1 = h('div', {}, '你好呀')
let vnode2 = h('ul', {}, [
    h('li', {key:'a'}, 'a'),
    h('li', {key:'b'}, 'b'),
    h('li', {key:'c'}, 'c'),
    // h('li', {key:'d'}, 'd'),
    // h('li', {key:'e'}, 'e'),
])
// console.log(vnode2);

patch(container, vnode2)

let vnode3 = h('ul', {}, [
    h('li', {key:'c'}, 'c'),
    h('li', {key:'b'}, 'b'),
    h('li', {key:'e'}, 'e'),
    h('li', {key:'a'}, 'a'),
    // h('li', {key:'d'}, 'd'),
])


let btn = document.getElementById('btn')
btn.onclick = () => {
    console.log('11');
    
    patch(vnode2, vnode3)
}
